home *** CD-ROM | disk | FTP | other *** search
/ Java Developer's Companion / Java Developer's Companion.iso / binaries / Windows / jsdk / src / sun / servlet / isapi / ISAPIConnection.java < prev    next >
Encoding:
Java Source  |  1997-07-18  |  3.9 KB  |  147 lines

  1. /*
  2.  * @(#)ISAPIConnection.java    1.10 97/05/11
  3.  * 
  4.  * Copyright (c) 1995-1997 Sun Microsystems, Inc. All Rights Reserved.
  5.  * 
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  * 
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  * 
  19.  * CopyrightVersion 1.0
  20.  */
  21.  
  22. package sun.servlet.isapi;
  23.  
  24. import java.io.IOException;
  25.  
  26. /**
  27.  * This class represents an ISAPI connection for the servlet runner.
  28.  *
  29.  * @version    1.10, 05/11/97
  30.  * @author    David Connelly
  31.  * @author    Jongyoon Lee
  32.  */
  33. class ISAPIConnection {
  34.     /*
  35.      * The C data for this ISAPI request.
  36.      */
  37.     private long ecb;
  38.  
  39.     /*
  40.      * Initializes the connection for the specified ECB data.
  41.      * @param ecb pointer to ExtensionControlBlock
  42.      */
  43.     void init(long ecb) {
  44.     this.ecb = ecb;
  45.     }
  46.  
  47.     /*
  48.      * Resets the connection for a new request.
  49.      */
  50.     void reset() {
  51.     ecb = -1;
  52.     }
  53.  
  54.     /*
  55.      * Sets the status code.
  56.      * @param status the status code
  57.      */
  58.     native void setStatusCode(long status);
  59.  
  60.     /*
  61.      * Returns the request method.
  62.      */
  63.     native String getMethod();
  64.  
  65.     /*
  66.      * Returns the query string or null if none.
  67.      */
  68.     native String getQueryString();
  69.  
  70.     /*
  71.      * Returns the path info or null if none.
  72.      */
  73.     native String getPathInfo();
  74.  
  75.     /*
  76.      * Returns the translated path.
  77.      */
  78.     native String getPathTranslated();
  79.  
  80.     /*
  81.      * Returns the content type or null if not known.
  82.      */
  83.     native String getContentType();
  84.  
  85.     /*
  86.      * Returns the virtual path translated to the real path.
  87.      * @param vpath the virtual path
  88.      */
  89.     native String getRealPath(String vpath);
  90.  
  91.     /*
  92.      * Returns the value of the specified server variable, or null if not
  93.      * found.
  94.      * @param name name of the server variable
  95.      */
  96.     native String getServerVariable(String name);
  97.  
  98.     /*
  99.      * Sends redirect URL.
  100.      * @param url the new url for redirection
  101.      */
  102.     native void sendRedirect(String url);
  103.  
  104.     /*
  105.      * Gets the data from ECB
  106.      * @param start indicates starting position within lpbData member
  107.      * @param buf byte array to return data
  108.      * @param off start position of the buf
  109.      * @param buflen number of bytes available in buf
  110.      */
  111.     native long getData(long start, byte[] buf, long off, long buflen);
  112.  
  113.     /*
  114.      * Writes the headers and status messages.
  115.      * @param status buffer that contains status message string
  116.      * @param soff offset of status buffer
  117.      * @param slen length of status buffer
  118.      * @param headers buffer that contains headers
  119.      * @param hoff offset of header buffer
  120.      * @param hlen length of header buffer
  121.      */
  122.     native void writeHeaders(byte[] status, long soff, long slen,
  123.                  byte[] headers, long hoff, long hlen);
  124.  
  125.     /*
  126.      * Reads from the client into the specified byte array. Returns -1 if
  127.      * no more bytes are available.
  128.      * @param b buffer to which read the data
  129.      * @param off offset of the buffer
  130.      * @param len length of the buffer
  131.      */
  132.     native long readClient(byte[] b, long off, long len) throws IOException;
  133.  
  134.     /*
  135.      * Writes the specified bytes to the client.
  136.      * @param b buffer that contains outgoing message
  137.      * @param off offset of the buffer
  138.      * @param len length of the buffer
  139.      */
  140.     native void writeClient(byte[] b, long off, long len) throws IOException;
  141.  
  142.     /*
  143.      * Informs the server that the operation has finished
  144.      */
  145.     native void finish();
  146. }
  147.